Calibration of the angle measurement error caused by the industrial reducer performance test instrument torsional deformation

The measurement of the stiffness of a precision reducer is essential to estimating the reducer. Since the angular sensor’s measurement results include the angle measurement error caused by the instrument’s torsional deformation, it cannot be used as the actual torsional deformation of the reducer. This paper analyzes the instrument’s torsional deformation characteristics to reduce the angle measurement error. Based on the analysis, a new method of calibrating the angle measurement error based on the improved B-spline curve fitting-gradient descent and particle swarm optimization -radial basis function neural network (IBSCF-GDPSO-RBF) method is proposed. The method can eliminate the angle measurement error caused by the instrument’s torsional deformation. The steps of the IBSCF-GDPSO-RBF method are presented, and the angular measurement error compensation is executed under load conditions. The experiment shows that the instrument deformation caused angle measurement error after compensation is within ± two angular seconds. This paper’s innovation proposes the error calibration method based on the IBSCF-GDPSO-RBF method. It provides a reference for measuring and evaluating the actual torsional rigidity of the Rotary Vector (RV) reducer under any load.

torque, and found that the relationship between stress and strain is linear in a particular range, and the deformation displacement error produced in the process of repeated testing is repetitive 24 . This feature ensures that the angle error caused by metal material deformation is a systematic error, which makes it possible to improve the angle measurement accuracy through a reliable and effective error compensation method. However, all the above research mainly concentrates on the simple deformation of a single part and is not suitable for the complex deformation of the transmission chain in the instrument under high torque.
In order to reduce the angle measurement error, the instrument's torsional deformation characteristics are analyzed. Based on the features, a new method of calibrating the angle measurement error based on the improved B-spline curve fitting-gradient descent and particle swarm optimization-radial basis function neural network (IBSCF-GDPSO-RBF) method is proposed to eliminate the influence of the instrument torsional deformation. The method is not limited to calibrating the angle measurement error caused by the unavoidable instrument torsional deformation.
The contribution of this paper is that the method calibrates and compensates for the angle measurement error based on the IBSCF-GDPSO-RBF method, which is not limited to measuring the torsional deformation of the RV reducer. The experiment proves that the method can quantitatively detect the proper RV reducer torsional rigidity under any load. It supplies a guideline for measuring and evaluating the proper RV reducer torsional rigidity under any load.

Analysis of angle measurement error caused by instrument deformation
Relying on the high-precision vertical reducer detector developed by the authors previously 25 , this paper focuses on measuring the torsional rigidity of the RV reducer. The instrument is composed of five subsystems, including a guide rail mechanism, a measurement system on the input side (MSIS), a tested assembly (TA), a measurement system on the output side (MSOS), and a workbench. The overall structure of the instrument is shown in Fig. 1. The external main frame of the instrument adopts a cylindrical structure, and the torque sensor is arranged at the position closest to the input and output end of the tested reducer. This design improves the rigidity of the instrument, simplifies the deformation form of the instrument, shortens the measurement chain, and reduces the number of error sources.
When testing the stiffness of the reducer, the instrument is locked at the MSIS and loaded at the MSOS. The angle measurement system at the MSIS can obtain the torsional stiffness characteristics from its position to the locking device, and the angle measurement system at the MSOS can obtain the torsional stiffness characteristics from its position to the locking device. Then the torsional deformation of the RV reducer is obtained using the measurement results of the angle measurement system at the MSIS minus the measurement results of the angle measurement system at the MSOS, as is shown in formula (1)- (3).
where θ r is the tested torsional deformation of the RV reducer, θ i is the measurement results of the angle measurement system at the MSIS. θ o is the measurement results of the angle measurement system at the MSOS. θ 2 is the torsional deformation of the shaft between the two angle measurement systems, θ ′ is the torsional deformation of the shaft between the angle measurement system at the MSIS and the locking device, θ is the actual torsional deformation of the RV reducer. It can be seen from the calculation process above that the influence of the unavoidable torsional deformation of the instrument cannot be excluded, as shown in Fig. 2, which means the measurement results include the angle measurement error caused by the torsional deformation of the shaft between the two angle measurement systems.
(1) θ o = θ 2 + θ ′ + θ , www.nature.com/scientificreports/ It can find out from Fig. 2 that the angle measurement error caused by the deformation of the instrument mainly consists of two parts. The first one is the angular measurement error caused by the deformation of the spline coupling in the transmission chain shaft. The second one is the angular measurement error caused by the deformation of the cylindrical platform. All of them are caused by the change in the internal force of the structure. Attention should be paid to the stress-strain characteristics of various shafting parts and the cylindrical bench to ensure that the angle measurement error caused by deformation can be effectively compensated. Considering that the factors leading to the deformation of spline coupling are mainly the combined effect of bending, shearing, torsion, and compression deformation of the spline tooth, the four kinds of deformation are calculated according to the elastic deformation theory of gear teeth 27 . The calculation process adopts the improved integral method. The spline tooth is subdivided into several rectangles by the improved integration method, and the deformation of each rectangle under the action of the uniform force is regarded as the deformation of a cantilever beam under the action of a concentrated force to obtain the deformation components caused by the four cases. The effect of the four types of tooth deformation is shown in Fig. 3, and the force on spline teeth is shown in Fig. 4. The stiffness characteristics of each component in the transmission chain are analyzed in the following section. Furthermore, the angle measurement error model is constructed 26 .
In Fig. 4, f is the force uniformly distributed on the surface of the key tooth, and the equal force of the uniformly distributed force F i acts on point i , where L is the key width of the rectangular spline tooth, H is the    www.nature.com/scientificreports/ height of the key tooth, and H i is the height from the equal force action point i to the root of the key tooth, W is the thickness of the key tooth, S is the cross-sectional area of the key tooth, I x c is the polar moment of inertia of the cross-section, μ is Poisson's ratio, and E is elastic modulus.
(1) Angle measurement error caused by shaft deformation. For the transmission chain shaft described in this paper, the radius is r 1 and the length is L 1 . The angular measurement error �θ 1 caused by cylindrical shaft deformation is 27 : In the above formula, G is the material's shear modulus, and T is the transmitted torque.
(2) Angle measurement error caused by deformation of cylindrical bench. For the cylindrical bench of the instrument, the primary diameter is d 1 and the minor diameter is d 2 . The length of the cylindrical bench, located between the circular grating reading head and the tested reducer, is L 2 . The angle measurement error �θ 2 caused by the deformation of the cylindrical bench is 27 : In the above formula, G is the material's shear modulus, and T is the transmitted torque.
(3) Angle measurement error caused by spline tooth bending deformation. The bending deformation of spline teeth can be equivalent to the deformation of the cantilever beam fixed at one end under external force. The bending moment M 1 of the spline teeth is: In the equation above, H i is the height from the equal force action point i to the root of the key tooth, W a is the half-tooth thickness corresponding to the point of equivalent force, H is the key tooth height, T is the transmitted torque, r 2 is the spline pitch circle radius, α is the angle between the equivalent force and spline radial direction.
The angle measurement error �θ 3 caused by the bending moment M 1 is: where I x c is the inertia couple of the intersecting surfaces, E e is the equivalent elastic modulus. The formula used to calculate E e is as follows: where µ is the Poisson's ratio, and E is the elastic modulus. Generally, E=210000Mpa, µ = 0.3. (4) Angle measurement error caused by spline tooth shear deformation. The shear deformation and bending deformation of spline teeth have a superposition effect. The shear deformation here refers to the displacement change of teeth under the tangential shear force. Angle measurement error �θ 4 caused by shear deformation from the tooth root to the contact point can be expressed as: In the equation above, G is the shear modulus, S is the sectional area, and T is the transmission torque. The general formula of G is: In the equation above, the sectional area S is a rectangle, and its calculation formula is: In the equation above, S is the sectional area at the spline contact point, L is the tooth width, and W a is the half-tooth thickness at the contact point.
(5) Angle measurement error caused by torsional deformation of spline teeth. For the angle measurement error caused by the torsional deformation of spline teeth, the most critical consideration is the change of basal body at the tooth's root. Under the action of bending moment, the calculation formula of spline tooth stiffness is as follows: In the equation above, S 0 is the sectional area at the tooth root, W 0 is the half-tooth thickness at the tooth root. The angle measurement error �θ 5 caused by the deformation of the basal body at the tooth root under the effect of the transmitted torque T can be expressed as: . www.nature.com/scientificreports/ (6) Angle measurement error caused by spline tooth compression deformation. Compression deformation mainly refers to the compression of the basal body at the tooth's root. The angle measurement error �θ 6 caused by the combined compression deformation in the radial and tangential directions can be expressed as: In the equation above, ν 1 is the Poisson's ratio of spline sleeve, ν 2 is the Poisson's ratio of spline shaft, E 1 is the elastic modulus of the spline sleeve, E 2 is the elastic modulus of the spline shaft, R 1 is the radius of the spline sleeve, R 2 is the radius of the spline shaft, and T is the torque transmitted.
Based on the above six types of angle measurement errors, the total angle measurement error �θ is: It can be figured out that there is a nonlinear relationship between the angle measurement error �θ and the transmitted torque T . Equation (15) does not fully reflect the angle measurement error. It only considers the angle measurement error caused by the deformation of each component in the shaft and does not consider the angle measurement error caused by the combination of spline coupling, compression positioning, and other contact methods used for the shafting connection. The contact stability between components in the shaft under ample torque must be considered in the calibration and compensation of angle measurement error. Therefore, the model formula cannot analyze the angle measurement error caused by the deformation of the shaft. The deformation of the shaft needs to be identified from the angle measurement results, and then the relationship between transmitted torque and angular displacement of the shaft should be further obtained. The following part of this paper focuses on calibrating and compensating for the angle measurement error caused by the deformation of the drive chain shafting in the instrument.

The calibration method of the angle measurement error caused by instrument deformation
According to the second section analysis, measuring the angle measurement error caused by the shaft's deformation and obtaining the relationship between the angle measurement error and transmitted torque is necessary. As mentioned above, when the tested reducer is loaded on the instrument, the measurement results of the angular sensor on the instrument will inevitably include the angle measurement error caused by the torsional deformation of the shaft. It is necessary to obtain the comprehensive deformation of the transmission chain at the MSIS and MSOS to improve the measurement accuracy of the stiffness curve of the reducer. The best idea to exclude the influence of the instrument's deformation is to use an ideal reducer with known stiffness as the standard body. When the reducer with ideal stiffness is located at the measured position, the deformation of the instrument's components can be obtained using the measurement results of the angle measurement system minus the deformation of the ideal standard reducer. The result is recorded as �θ . It means the angle increment �θ is caused by the deformation of the instrument's components. In the test of the deformation of other reducers, it is necessary to eliminate the deformation angular displacement �θ . Then, the characteristics of the tested reducers are analyzed.
The ideal reducer with known stiffness is difficult to find in practice. The entity with quasi-infinite stiffness can be used to replace the reducer with known ideal stiffness. As shown in Fig. 5, the MSIS (or MSOS) measuring shafts are directly consolidated with the barrel (its stiffness is quasi-infinite). The MSIS (or MSOS) motors apply torque from zero to the full range required for the test. At the same time, the outputs of the angle measuring system and torque measuring system at the MSIS (or MSOS) are recorded, and the "angular displacement-torque" curve is formed. This curve represents the rule of comprehensive deformation of instrument shafts, which can be used to obtain the angle measurement error caused by the deformation of the shafts. This angular displacement in the curve is the angular measurement error value to be compensated during the reducer test. The circular grating system reads the angular displacement, so it just represents the part of the deformation of instrument shafts included in the angle measurement results. The part of the deformation that is not included in the circular grating reading can be ignored because it does not affect the accuracy of the angle measurement of the instrument.
The feature of this idea is that it is not necessary to know the deformation of every component or the contact form between components in the actual measurement process. The angle measurement error caused by the deformation of the shafts can be obtained through the actual measurement. The angular displacement introduced by the measured reducer angular displacement and instrument structure deformation could be identified through this idea. This paper proposes an angle-torque calibration method based on this idea. The instrument deformation calibration device is designed, as shown in Fig. 6. The real-time special compensation for angle measurement error caused by instrument deformation is realized.
The designed instrument deformation calibration device adopts the exact positioning and clamping structure as the TA. Furthermore, it can be installed on the instrument and matched with the MSIS and MSOS mechanical interfaces to calibrate the angle measurement error caused by the deformation of the instrument shafting under specific torque. When the MSIS and MSOS are subject to torque, the readings of the angle measuring system (13) �θ 5 = TcosαH − TsinαW a k j r 2 . (14) . www.nature.com/scientificreports/ at the MSIS and MSOS reflect the angle measurement error caused by the comprehensive deformation of the respective drive chain shafting and cylindrical workbench at the MSIS and MSOS. Then the angle data under different torques should be recorded, and the angle measurement error list of the measuring system at the MSIS and MSOS should be formed.
In the angle measurement error calibration, one-way loading and one-way unloading are adopted to avoid discontinuity and difficulty in fitting. That is, in the order of ④ → ⑤ → ② → ③, as shown in Fig. 7. Therefore, one-way loading and one-way unloading are adopted in the process of angle measurement error calibration, and whether the backlash in the calibration process is lower than the set threshold value is judged. If the backlash is   www.nature.com/scientificreports/ higher than the set threshold value, it is necessary to check whether the fixed state of the shafting is normal. The calibration process of angle measurement error caused by deformation is shown in Fig. 8.

Compensation method for the angle measurement error caused by instrument deformation
Due to the extensive torque loading range of the instrument and the instability of loading, it is difficult to calibrate the angle measurement error caused by the deformation of the instrument in the whole torque loading range continuously during the calibration process. Because only some torque loading points are calibrated, a specific method must be adopted to realize the real-time compensation of angle measurement error within the entire torque loading range. This paper selects 1000 points evenly distributed in the loading range for angle measurement error calibration. At the same time, the average value filtering method is used to offset the impact of loading stability as much as possible.
In the quasi-static experiment, the angle measurement error caused by the combined deformation of the MSIS and MSOS shafting and the cylindrical worktable is nonlinear with the transmitted torque. Therefore, after obtaining the angle measurement error caused by the deformation of the MSIS and MSOS, the IBSCF-GDPSO-RBF method is used to obtain the angle measurement error-loading torque relationship model. The IBSCF-GDPSO-RBF method combines improved B-spline curve fitting, gradient descent, particle swarm optimization, and radial basis function neural network. The IBSCF-GDPSO-RBF method is used because the improved B-spline curve fitting method can fit any nonlinear function relationship with the smallest residual possible, and the GDPSO-RBF method can approach any function with arbitrary accuracy. The IBSCF-GDPSO-RBF method can be used to make full use of discrete calibration points and realize continuous difference compensation in the measurement range. The method is described in detail below. Improved B-spline curve fitting (IBSCF). Traditional B-spline curve fitting is to fit a curve every four points. The curve does not pass-through type value points but has the advantages of locality, continuity, and convexity. The equation of B-spline curve fitting is: where, P i is the characteristic polygon vertex, also known as the control vertex. B i (t) is the basis function. The basis function can be expressed as: www.nature.com/scientificreports/ According to the characteristics of the B-spline curve fitting endpoint, it is only necessary to make the type value point located at the middle line of the triangle bottom, 1/3 away from the vertex, and the tangent vector of the type value point parallel to the bottom to make the fitted curve pass through the type value point and reduce the error. Therefore, the original type value points can meet the above conditions by adding type value points. Moreover, the starting and end points of the curve are specially treated, which is the basic idea of the IBSCF algorithm.
Assuming that the number of original type value points is n, 3n-3 B-spline curves can be obtained by increasing the number of type value points to 3n, and all original type value points can be passed. The new value point coordinates calculation method is given below, excluding the first and last endpoints.
According to Eqs. (16)- (20), the three continuous fitting curves can be expressed in matrix form as: Since the basis function of the traditional B-spline curve has a coefficient of 1/6, h = 1/6 is taken in the expression of the improved B-spline curve fitting method. According to Eqs. (21) and (22), all type value points are represented by original type value points. Taking P 1 , P 2 , P 3 , and P 4 points as examples, the equation of the fitting curve expressed in the form of a matrix is as follows: Then curve fitting can be carried out section by section according to Eq. (26) ~ Eq. (28) to determine the fitting curve obtained by the improved B-spline curve fitting algorithm. Since the basis function of the improved B-spline curve fitting algorithm is based on the basis function of the B-spline curve fitting algorithm, the interpolation curve not only has the advantages of the local, continuous and convex hull of the traditional B-spline curve but also improves the curve fitting accuracy through all the original type value points.
GDPSO-RBF neural network model. The RBF neural network algorithm has strong nonlinear mapping ability and generalization ability. Its model includes an input layer, at least one hidden layer, and one output layer. This algorithm does not need to consider the linearity or nonlinearity of the compensation object and only focuses on the input and output conditions. The approaching equation effect of the RBF neural network is better when the system is stable, and the influence of environmental factors is small. Especially when there are many sample points and the compensation accuracy is high 28,29 . Therefore, a radial basis function (RBF) neural network can be used to realize continuous compensation. As shown in Fig. 9, the RBF neural network for the error compensation is a three-layer unidirectional propagation network. The loading torque and the angle measurement error are used as the learning samples of the input and output layers, respectively, for training. www.nature.com/scientificreports/ The input layer neurons directly map the input data to the hidden layer neurons. The dimension of the center vector is equal to the dimension of the input vector. The dimension of the center vector on the hidden layer neuron is equal to twenty, which is verified to be converged fastest through repeated debugging. The Gaussian function is selected as the basis function on the hidden layer node of the RBF neural network. The role of the Gaussian function in the RBF neural network model is to activate samples: In the equations above, T i represents the input sample, c k represents the central vector of the hidden layer neuron whose dimension is equal to the input sample dimension, σ k indicates the width of hidden layer neurons, and ‖ u ik T i − c k ‖ represents the Euclidean distance between the center vector and the sample. c k , σ k and W ik are called mathematical parameters of the neural network model. When the value of σ k is constant, the value of the RBF function reaches the maximum at ‖ u ik T i − c k ‖ where it is zero and decays rapidly to zero as the distance increases. Therefore, when the width σ k and the center vector c k are determined, the RBF function has the characteristics of local response to sample T i . The final prediction result for a single sample is a linear combination of the outputs of all hidden layer nodes: In the equations above, W ik denotes the output weights from R k to �θ i . Equation (30) can calculate the target prediction result according to the known input sample data, so Eq. (30) is the neural network prediction model. The difference between the result vector and the expected output vector is the overall sample fitting error: Here, �θ ′ ik represents the result vector of the output layer. It can be seen that the RBF neural network model is an accurate mathematical model with uncertain parameters. When the structure and mathematical parameters of the network are determined, the output results of the same input sample will not change. Therefore, the design process of the RBF neural network model is the process of determining the structure and mathematical parameters: the process of adjusting the center vector and width is the process of selectively responding to the samples. Its essence is the reasonable distribution of the center vector in the overall sample space. From a mathematical point of view, the adjustment of W ik can be understood as a linear equation-solving process.
After initializing the parameter values, the traditional RBF model uses sample clustering or gradient descent to solve the structure and mathematical parameters. This highly targeted, accurate mathematical algorithm often leads to the model's inability to find the optimal global solution 30 . In this paper, gradient descent and particle swarm optimization (GDPSO) methods are used to solve the center vector, hidden layer neuron width, and hidden layer neuron weight, which can not only improve the global search performance of the algorithm but also give consideration to the operation speed and local optimization performance. The GDPSO is a swarm intelligence algorithm. Each particle in the population corresponds to a candidate solution to a problem. Affected by both learning and memory, the particle transitions to complete global optimization tasks in the multi-dimensional solution space. The basic process is as follows: It is assumed that the solution space dimension is d and the particle population size is s. The particle position is substituted into the problem objective function to solve the corresponding fitness of the particle, the individual historical optimal fitness and the optimal global fitness are recorded, and the speed of particle i is given. Then, when the fitness value does not meet the requirements, the position and speed of particles are iteratively calculated. The iterative formula of speed and position is shown in Formula (32) and Formula (33):  www.nature.com/scientificreports/ In the above equations, m is the number of iterations, j represents the jth element in the vector, x m ij is the location of particle i in space, v m ij is the speed of particle i in space, p m ij and g m j are defined as local and global fitness, respectively. c 1 and c 2 are acceleration coefficients, r 1 and r 2 are random numbers in the interval [0,1], and w is the weight.
In the equation above, m max is the maximum number of iterations, w max and w min represents the maximum and minimum weights, respectively.
The traditional particle swarm optimization algorithm does not deal with discrete optimization problems. The Gradient descent (GD) algorithm is used to find the optimal global solution of the RBF neural network and avoid falling into local optimum or non-convergence. The GD algorithm is a supervised optimization learning algorithm. Unlike the general heuristic algorithm, the basic theory of GD is the principle of calculus. It finds the direction in which the objective function value can produce the maximum change in the multi-dimensional solution space by solving the derivative and moves closer to that direction with a specific step size to achieve the goal of decreasing or raising the objective function.
The specific method is as follows: the objective function is maximized or minimized, and the objective function is required to calculate the partial derivatives of all independent variables. The obtained partial derivatives are scientifically reduced as the step size for adjusting the corresponding independent variables, and the iterative operation is carried out until the objective function value meets the problem requirements. The word "scientifically" here means following the simple line-search guidelines.
Aiming at the parameter optimization of the RBF neural network model and considering the practicability of optimization efficiency, the objective function of the GD algorithm is obtained as follows: Particle swarm optimization (PSO) with gradient affects the update of particle velocity by introducing gradient information. Each particle is updated probability p according to the negative gradient. Moreover, the PSO is updated according to the probability of 1-P. In this way, when the optimal information of the group is stagnant, some group particles can be reinitialized to keep the group's activity and reduce the possibility of the group falling into the local optimum. At the same time, we can adjust w, c 1 , and c 2 to thoroughly search each area early and accelerate the convergence later. Some other mechanisms can be introduced, such as random factors, boundary changes in speed and position, etc. Combine with other optimization algorithms: genetic algorithms, simulated annealing algorithms, etc., to help particles jump out of local optimum and control convergence speed.
The GDPSO algorithm steps are as follows: Step 1: Determine relevant parameters, particle swarm size, the maximum number of iterations, linear inertia weight, acceleration coefficient, target accuracy, RBF hidden layer node number, and gradient descent selection probability.
Step 2: Determine the initial distribution interval of particle position and velocity, randomly initialize the particle position and velocity matrix, and rank the position and velocity parameters in the order of neuronwidth center-vector weight.
Step 3: Determine the evaluation function of particles.
Step 4: Substitute the existing particles into the evaluation function to obtain the evaluation value, update the particles' historical and global extreme value, and judge whether the evaluation value < ε or k > iter-max is met. If yes, the algorithm ends and records the optimal position of the existing particles; If not, turn to step 5.
Step 5: The particles are selected by probability. GD iterates the selected particles, and the remaining particles are iterated by Formula (32) and Formula (33).
The realization steps of the GDPSO-RBF model include neural network construction, training, and prediction. Three (or more than three) groups of one thousand points evenly distributed in the loading range obtained from the angle measurement error calibration are taken as the training sample. Another three (or more than three) groups of one thousand points evenly distributed in the loading range obtained from the angle measurement error calibration are taken as the testing sample. The training is mainly to assign the optimal weight and threshold obtained by the GDPSO algorithm to the RBF neural network as the initial weight and point of the network. The training samples are substituted into the network for training and testing. If the actual output of 1000 test samples is consistent with the expected result, the network's generalization ability is good, and the training is completed. Finally, the angle measurement errors in the loading range are predicted. The above three-step process can be realized using the newrb-function, train-function, and sim-function provided by the neural network toolbox in MATLAB. www.nature.com/scientificreports/ IBSCF-GDPSO-RBF method. As described above, the loading stability limits the number of sampling points. Traditional numerical compensation methods, such as the polynomial fitting and the B-spline curve fitting, are used to fit the angle measurement error caused by deformation. However, it is challenging to model nonlinear data or data features with correlation polynomial regression, and it is challenging to express highly complex data well. The fitted angle measurement error model cannot fully reflect the characteristics of the relationship between the angle measurement error and the loading torque due to the limitation of the sample points' number. So the compensation effect is limited. On the contrary, the RBF neural network has the following advantages: 1. Its multi-layer nonlinear structure can express very complex nonlinear relations. 2. The flexibility of its model makes us not need to care about the data structure. 3. The more data, the better the network performance. Because of this, this paper combines the improved B-spline curve fitting method with the GDPSO-RBF neural network method. Based on the IBSCF-GDPSO-RBF method, compensation accuracy for the angle measurement error is further improved. The specific implementation steps of the IBSCF-GDPSO-RBF combination fitting method are as follows.
Step 1: Measuring multiple groups of angle measurement errors caused by the combined deformation of the MSIS (or MSOS) with different initial loading torque values. The instrument deformation calibration device is installed on the instrument, and the initial loading torque value is 0 Nm (± 0.01 Nm). Then the loading torque value of MSIS is adjusted to 0.05 Nm, 0.1 Nm, 0.15 Nm, 0.15 Nm, 0.2 Nm · · · , and 50 Nm (or 2 Nm, 4 Nm, 6 Nm, 8 Nm, 10 Nm · · · , and 2000 Nm for the MSOS). One thousand points (T i , �θ i ) in the whole torque loading range (i = 1, 2, …, 1000) are obtained again. The experiment is repeated three times to obtain the first group angle measurement errors caused by the combined deformation of the MSIS (or MSOS).
Step 2: Fitting the relationship curve. The angle measurement error-loading torque relationship model �θ(T) is fitted based on the angle measurement error and the loading torque using the improved B-spline curve fitting method.
Step 3: Multi-group data prepossessing. The angle measurement error and the loading torque are used as the benchmark. Selecting the loading torque interval (T 1 i , �θ 1 i ) within which the angle measurement errorloading torque relationship model �θ(T) of the angle measurement error value has a stable variation trend. The loading torque quantity (T 2 i , �θ 2 i ) , (T 3 i , �θ 3 i ) the other two groups are selected. Then the adjustment coefficients a 2 i and a 3 i of the other two groups can be obtained using the fitting value �θ T 2 i , �θ(T 3 i ) of the angle measurement error values, subtract the value �θ 2 i and �θ 3 i of the actual angle measurement error, that is: Then a 2 i and a 3 i are added to the value �θ 2 i and �θ 3 i to calculate the angle measurement error value according to formula (38)-(40), the final angle measurement error value could be correlated.
Step 4: The prepossessing data of the angle measurement error-loading torque (T i , �θ i ) is substituted with the GDPSO-RBF neural network. The final relationship model between the angle measurement error-loading torque is obtained. The hidden layer node number is obtained according to Eq. (29). Furthermore, the effect is estimated according to the fitted relationship model.
In testing the relevant parameters of the reducer, the corresponding angle error compensation value is calculated according to the loading torque value brought into the angle measurement error-loading torque relationship model and compensated for the final angle measurement result. Then the actual torsion angle of the reducer can be obtained using the angle measurement result minus the angle error compensation value. In this way, the compensation for the angle measurement error caused by the deformation of the transmission chain shafting in the MSIS and MSOS can be realized, respectively. After the error compensation, the torsion angle of the reducer under any torque is: Finally, the stiffness and other relevant parameters can be calculated according to the torsion angle under any torque after error compensation.

Experiment results
According to the angle measurement error calibration and compensation method proposed in the third and fourth sections, a series of experiments were designed to determine the accuracy of the calibration and compensation of angle measurement error and the accuracy of the RV reducer deformation measurement based on the proposed method 31 . First, the error calibration experiment under different loading torques was carried out on www.nature.com/scientificreports/ the precision reducer detector, as shown in Fig. 10. The list of "angle measurement error-loading torque" of the MSIS and MSOS is obtained. Then, the angle measurement error-loading torque relationship curve is fitted using the IBSCF-GDPSO-RBF method. Besides, the MSIS (or MSOS) motor is used again to synchronously load the torque to the instrument deformation calibration device and the MSIS (or MSOS), and the error compensation method described in this paper is used to compensate for the angle measurement error. This step is carried out to verify the effect of error compensation. Last but not least, the TA was installed on the instrument, and the stiffness of the reducer was tested based on the error compensation method. Modrol Electric CO., Ltd made the servo motor (or torque motor) used in the MSIS (or MSOS). In the experiment, the MSIS (or MSOS) was driven by the servo motor (or torque motor). The servo motor (or torque motor) was controlled to work in the torque mode to ensure loading stability during the measurement. The model of the servo motor was SMS15-42P2C. The loading range of the servo motor was 50 Nm, and the loading accuracy of the servo motor was 0.1% on the full scale. The model of the torque motor was SMC35-42T2A. The loading range of the torque motor was 2000 Nm, and the loading accuracy of the torque motor was 0.1% on the full scale.
The HBM company produced the torque transducer used in the instrument. The model of the torque transducer was T40B. The torque transducer measuring range in the MSIS (or MSOS) was 0-50 Nm (or 0-2000 Nm), and its measuring accuracy was 0.1% at full scale. Angular measurement systems in MSIS and MSOS adopt absolute optical encoders produced by the Renishaw company. The model of the absolute optical encoder was RESA-30U-S-A3000-B. Its measuring accuracy is 0.96″. A PXIe acquisition system produced by the National Instruments company was used to collect the angle signal and the torque signal at a rate of 25 k samples per second. The accuracy of torque signal acquisition was 0.01% on the full scale. The accuracy of angle signal acquisition was 0.01″.
The angle measurement error calibration. The instrument deformation calibration device calibrates the angle measurement error caused by instrument deformation. Its functional objective is to separate the angle measurement error and the deformation of the measured reducer under various torques. The basic idea is to replace the position of the measured reducer with an instrument deformation calibration device in the measuring shafting of the instrument and use the reading of the angle measurement system to represent the angle measurement error caused by the instrument deformation under a specific loading torque. The experiment of using the instrument deformation calibration device designed in this paper to calibrate the angle measurement error of the instrument shafting under different loading torques should be carried out according to the following procedures: ④ The step ③ is repeated three times in sequence. Take the average of the three measurement results as the "angle measurement error-loading torque" of the MSIS (or MSOS) measurement point. Then, the list of "angle measurement error-loading torque" is obtained.
After obtaining the list of "angle measurement error-loading torque" of the MSIS and MSOS, the angle measurement error-loading torque relationship curve can be fitted according to it using the IBSCF-GDPSO-RBF method. The instrument deformation calibration device is installed between the MSIS and MSOS to verify the effect of the error compensation method described in this paper. The error calibration experiment under different loading torques was carried out according to the above procedure. The list of "angle measurement error-loading torque" is obtained, and the angle measurement error-loading torque curve is fitted according to the list. The angle measurement error-loading torque curves of the MSIS and MSOS using the IBSCF-GDPSO-RBF method are shown in Figs. 11 and 12. The compensation values of angle measurement error of the MSIS and MSOS at any torque are obtained from these curves to compensate for the measured torsion angle of the reducer at any torque.
Verification of the angle measurement error calibration and error compensation method. Since the angle measurement error-loading torque curves of the MSIS and MSOS are obtained, then the motor of the MSIS and MSOS is used again to load the instrument deformation calibration device to verify the effect of the error compensation method described in this paper. According to the formula (41), the error compensation was realized using the angle measurement result minus the angle error compensation value calculated according to the loading torque value brought into the angle measurement error-loading torque relationship curve 31 . The angle measurement errors caused by the deformation of the MSIS and MSOS after error compensation are represented in Fig. 13 and 14, respectively. The results show that the maximum angular measurement error of the MSIS is ± 1″, and the maximum angular measurement error of the MSOS is ± 2″. The angular measurement accu-  www.nature.com/scientificreports/ racy of the MSIS and the MSOS can reach ± 2″ through error compensation. For comparison, the polynomial fitting and the B-spline curve fitting were used to compensate for the angular measurement error, respectively. The angular measurement error of the MSOS after compensation is shown in Fig. 15. Then, the TA was installed on the instrument, and the torsional stiffness of the RV-40E reducer was tested to verify the MSIS and MSOS error compensation effect using the IBSCF-GDPSO-RBF method. Torsional stiffness is one of the most critical static parameters of the reducer, which is used to measure the ability of the reducer to resist torsional deformation under the action of torque and directly or indirectly affects the positioning accuracy and bearing capacity of industrial robots in work. The essential requirement of the torsional stiffness test is to fix the input end of the reducer, gradually load the torque on the output end from the free state to the rated torque or set value, then reverse load to the rated torque or set value, and then return to the initial state. In this process, the corresponding values of the angle at the output end and the loaded torque are recorded synchronously in real time. In the measurement process, since the reducer is fixed at the input end, the angle at the input end should be zero. It means if the input end is fixed well enough, the input sensors (torque & angle) are not needed. If the measurement result of the angular sensor at the input end is not zero, the torsional deformation of the reducer should be obtained using the angle at the output end minus the output end conversion value of the input end angular sensor measurement result. This paper uses the subsection method to calculate the torsional stiffness data. According to the experimental requirements, the least square method is used to fit the slope k of the straight line for each curve segment, and its reciprocal is the torsional stiffness of the measured reducer corresponding to this segment. Assume that the segmentation space is -100% rated torque to -a% rated torque, -a% rated torque to + a% rated torque, and + a% rated torque to + 100% rated torque. The slope value of each curve can be obtained as k 1 , k 2 , k 3 . Then the torsional stiffness of -a% rated torque to + a% rated torque segment is: Figure 13. Errors of MSIS after compensation using the IBSCF-GDPSO-RBF method.  www.nature.com/scientificreports/ The torsional stiffness of -100% rated torque to -a% rated torque segment and a% rated torque to 100% rated torque segment are both: Three independent repeated experiments were conducted on the reducer. The torsional stiffness of the RV-40E reducer was calculated according to the reducer deformation under different torques measured in the three independent repeated experiments. The calculation results of the torsional stiffness are shown in Table 1.
It can be figured out from Table 1 that the measurement repeatability error of the reducer torsional stiffness is within ± 0.01Nm/angular second. After the angle measurement error compensation, the measurement accuracy of the reducer torsional stiffness is high, meeting the requirements of high-precision measurement.

Conclusion
The features of the angle measurement error caused by instrument deformation are studied based on the structure of the high-precision detector. Based on the features, a new method of calibration and compensation of the angle measurement error based on the improved B-spline curve fitting-gradient descent and particle swarm optimization -radial basis function neural network (IBSCF-GDPSO-RBF) method is proposed to eliminate the influence of the torsional deformation of the instrument. The problem that the change of instrument deformation affects the angle measurement accuracy of the instrument is solved. It can be carried out that the angle measurement error caused by the instrument deformation after compensation is within ± two angular seconds. The contribution of this paper is that the method calibrates and compensates for the angle measurement error based on the IBSCF-GDPSO-RBF method, which is not limited to the background of measuring the torsional deformation of the RV reducer. It provides a reference for measuring and evaluating the actual torsional rigidity of the RV reducer under any load.

Results
Torsional stiffness(Nm/") The first time 15.51 1.04 The second time 15.52 1.06 The third time 15.50 1.05